home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_05 / allison / tset2.h < prev   
C/C++ Source or Header  |  1995-03-27  |  654b  |  35 lines

  1. LISTING 27 - Illustrates a set of Persons
  2. // tset2.cpp
  3. #include <iostream.h>
  4. #include "set2.h"
  5. #include "person3.h"
  6.  
  7. main()
  8. {
  9.     Set<Person> s;
  10.     Person p1("Waller","Fats",Date(10,10,1910),"N/A");
  11.     Person p2("Domino","Fats",Date(1,1,1947),"123-45-6789");
  12.  
  13.     s.insert(p1);
  14.     s.insert(p2);
  15.     cout << s << endl << endl;
  16.  
  17.     s.remove(p2);
  18.     cout << s << endl;
  19.     cout << "s "
  20.          << (s.contains(p2) ? "does" : "does not")
  21.          << " contain p2" << endl;
  22.     return 0;
  23. }
  24.  
  25. /* Output:
  26. {{Waller,Fats,[October 10, 1910],N/A}
  27. {Domino,Fats,[January 1, 1947],123-45-6789}
  28. }
  29.  
  30. {{Waller,Fats,[October 10, 1910],N/A}
  31. }
  32. s does not contain p2
  33. */
  34.  
  35.